package org.example.exceptionHandler;

/**
 * TODO 类描述
 *
 * @author shaoxuan.
 * @date 2023/12/23 14:14
 */

import org.example.common.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @description: 自定义异常处理
 * @author: DT
 * @date: 2021/4/19 21:17
 * @version: v1.0
 */
@ControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(value =Exception.class)
    @ResponseBody
    public R exceptionHandler(Exception e){
       System.out.println("全局异常捕获>>>:"+e);
        return R.error("系统异常");
    }
}
